<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
    <div>
        <input type="text" name="keyword" placeholder="查找博客标题、摘要、内容、分类、作者">
        <input type="button" value="查找" onclick="query()">
        <input type="button" value="新增" onclick="add()">
    </div>

    <table id="tb">
        <tr>
            <th>Id</th>
            <th>标题</th>
            <th>摘要</th>
            <th>内容</th>
            <th>分类</th>
            <th>作者</th>
            <th>发表时间</th>
            <th>操作</th>
        </tr>
       
    </table>

    <script src="./js/jquery-3.6.0.min.js"></script>
    <script src="./config/baseUrl.js"></script>
    <script src="./js/api.js"></script>
    <script src="./js/init.js"></script>

    <script>
        function query(){
            let keyword =$('[name=keyword]').val();
            getKeyword(keyword);
        }
        function add(){
            location.href ='./addOrEdit.html';
        }
        function edit(id){
            location.href ='./addOrEdit.html?id=' +id;
        }
        function del(id){
            delBlogById(id).then(res=>{
                if(res.code ===1000){
                    alert('是否删除');
                    let id =res.data.id;
                    $(`[key=${id}]`).remove();
                }else{
                    alert(res.msg);
                }
            })
        }
    </script>
</body>
</html>